<?php

namespace app\admin\model;

use think\Model;

class Stock extends Model
{
    // 表名
    protected $name = 'stock';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
    ];

    public static function getTypeList()
    {
        $typeList = array('1'=>"半成品",'成品');

        return $typeList;
    }
    public function getCidAttr($value){
        $db = new Githouse();
        $info = $db->where(array('id'=>$value))->field('gname')->find();
        return $info['gname'];
    }
    public function getShopidAttr($value){
        $db = new Preproduct();
        $info = $db->where(array('id'=>$value))->field('cname')->find();
        return $info['cname'];
    }
    public function getFirstAttr($value){
       return $value==0 ? "半成品" : "成品";
    }








}
